home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / pd / netz / interinstall / interinstall.rexx < prev    next >
OS/2 REXX Batch file  |  1995-08-25  |  6KB  |  211 lines

  1. /*                        iNTERiNSTALL v1.51
  2. */
  3. /* Installs AmiTCP 3.0b2 & PPP 1.30 to provide Internet access via dialup.
  4.    This requires that AMITCP and PPP are in subdirectories of iNTERiNSTALL,
  5.    as `AmiTCP-3.0b2' and `PPP' respectively.
  6.  
  7. */
  8. /* By Christopher Laprise (email: chrisl@ici.net)
  9. */
  10.  
  11.  
  12.  
  13. arg cpu
  14. cpu=word(cpu,2)
  15. if ~show('Lib','rexxsupport.library') then call addlib('rexxsupport.library',0,-30,0)
  16.  
  17. say
  18. say "   iNTERiNSTALL performs an installation and setup for AMITCP and"
  19. say "  PPP that is apropriate for dialup Internet access. No other"
  20. say "  installation should be performed with these two programs.        "
  21. say
  22. say "   Please make sure you have un-arced them into the iNTERiNSTALL"
  23. say "  directory as per the readme file before proceeding."
  24. say
  25. say  cpu "CPU detected."
  26.  
  27. options prompt "Proceed with install? (y/n) :"
  28. pull pro
  29. if pro~="Y" then exit
  30.  
  31.  
  32. say
  33. stat=0
  34. address command 'search #?.IIMOD "#MODULE" nonum'
  35. if rc>4 then do
  36.   say "No install modules were found in the iNTERiNSTALL dir."
  37.   stat=1
  38. end
  39. if exists("AmiTCP-3.0b2") then tcpsrc="AmiTCP-3.0b2"
  40. else if exists("AmiTCP-4.0") then tcpsrc="AmiTCP-4.0"
  41.      else do
  42.        say "AmiTCP-3.0b2 or AmiTCP-4.0 subdirectory wasn't found in the iNTERiNSTALL dir."
  43.        stat=1
  44.      end
  45. if ~exists("PPP") then do
  46.   say "PPP subdirectory was not found in the iNTERiNSTALL dir."
  47.   stat=1
  48. end
  49. if stat then exit
  50.  
  51.  
  52. modules=""
  53. address command 'list >t:interinstall #?.IIMOD FILES NOHEAD QUICK'
  54. call open("L","t:interinstall","R")
  55. do until eof("L")
  56.   modules=modules||" "||readln("L")
  57. end
  58. call close("L")
  59. modules=strip(upper(modules))
  60.  
  61. if words(modules) > 1 then do
  62.   say
  63.   do i=1 to words(modules)
  64.     say i||")" word(modules,i)
  65.   end
  66.   do until pro>0 & pro<=words(modules)
  67.     options prompt "select: "
  68.     pull pro
  69.   end
  70.   modfile=word(modules,pro)
  71. end
  72. else modfile=modules
  73.  
  74.  
  75. if cpu<68020 then cpu="000"
  76. else cpu="020"
  77. if ~exists("devs:networks") then address command "makedir devs:networks"
  78. if ~exists("devs:networks/ppp.device") then address command "copy PPP/devs/ppp.device."||cpu||".eval devs:networks/ppp.device"
  79.  
  80.  
  81. options prompt ": "
  82. say
  83. say "Enter the device name (ex: serial.device) for your modem"
  84. parse pull devicename
  85. if strip(devicename)="" then devicename="serial.device"
  86. say
  87. say "Enter the device unit# (ex: 0) for your modem"
  88. pull devicenumber
  89. if strip(devicenumber)="" then devicenumber=0
  90. say
  91. say "Enter the highest port speed (ex: 38400) for your modem"
  92. pull portspeed
  93. if strip(portspeed)="" then portspeed=38400
  94. line=devicename devicenumber portspeed "0.0.0.0 SHARED 7WIRE CD SERBUF=4096 DIALSCRIPT=env:sana2/ppp.dial"
  95. if ~exists("envarc:sana2") then address command "makedir envarc:sana2"
  96. call open("A","ENVARC:sana2/ppp0.config","W")
  97. call writeln("A",line)
  98. call close("A")
  99. call open("B","ENVARC:IPMODEMPORT","W")
  100. call writeln("B",devicename||" "||unit)
  101. call close("B")
  102. if exists("ENVARC:ICISMODEMPORT") then address command "delete ENVARC:ICISMODEMPORT"
  103.  
  104. call open("I",modfile,"R")
  105. call open("O","envarc:sana2/ppp.dial","W")
  106. do until strip(upper(line))="#END"
  107.   line=readln("I")
  108.   if word(line,1)=";INSTALL" then do
  109.     say
  110.     say delword(line,1,1)
  111.     parse pull response
  112.     buf=readln("I")
  113.     buf=insert(response,buf,pos("$RESPONSE",buf)-1)
  114.     buf=delstr(buf,pos("$RESPONSE",buf),9)
  115.     call writeln("O",buf)
  116.   end
  117.   else if strip(line)~="" then call writeln("O",line)
  118. end
  119. call close("O")
  120. call close("I")
  121.  
  122.  
  123.  
  124. say d2c(12)||"Installing from" tcpsrc
  125. address command 'assign >env:TCPASSIGN AMITCP: exists'
  126. if rc>4 then do
  127.   do until exists(tcppath)
  128.     say
  129.     say "Enter path where the AMITCP dir is to be created (ex: HD1:COMM)."
  130.     say "Do not enter iNTERiNSTALL or its subdirs"
  131.     pull tcppath
  132.     tcppath=strip(tcppath)
  133.     if tcppath="" then exit
  134.     if ~exists(tcppath) then say tcppath "DOES NOT EXIST."
  135.   end
  136.   if pos(right(tcppath,1),"/:")=0 then tcppath=tcppath||"/AMITCP"
  137.   else tcppath=tcppath||"AMITCP"
  138.   address command 'makedir "'||tcppath||'"'
  139.   address command 'assign AMITCP: "'||tcppath||'"'
  140. end
  141. else do
  142.   call open("A","env:TCPASSIGN","R")
  143.   tcppath=word(readln("A"),2)
  144.   call close("A")
  145.   say "...to the ASSIGNed path " tcppath
  146.   say
  147.   options prompt "Proceed? (y/n) :"
  148.   pull pro
  149.   if pro~="Y" then exit
  150. end
  151.  
  152. say "Please Wait... Installing to" tcppath
  153. address command 'copy from' tcpsrc 'to "'||tcppath||'"clone all quiet'
  154. address command "copy from TCPADD to amitcp: clone all quiet"
  155. if tcpsrc="AmiTCP-4.0" then
  156.   address command "copy from TCP4ADD to amitcp: clone all quiet"
  157. else
  158.   address command "copy from TCP3ADD to amitcp: clone all quiet"
  159. address command "copy from PPP/bin to amitcp:bin clone quiet"
  160. address command "protect internet +S"
  161. address command "protect stopnet +S"
  162. address command "protect loadsocket +S"
  163. address command "copy internet s: clone"
  164. address command "copy PPP/PPP.guide amitcp:doc quiet"
  165. address command "copy PPP/REGISTRATION amitcp:PPP-REGISTRATION quiet"
  166. address command "copy stopnet amitcp:bin clone"
  167. address command "copy amitcp:db/passwd-example amitcp:db/passwd"
  168.  
  169.  
  170. options prompt ": "
  171. call open("I",modfile,"R")
  172. if tcpsrc="AmiTCP-4.0" then call open("O","AmiTCP:db/resolv.conf","W")
  173. else call open("O","AmiTCP:db/netdb-myhost","W")
  174. do until strip(upper(line))="#END"
  175.   line=readln("I")
  176. end
  177. do until eof("I")
  178.   line=readln("I")
  179.   if word(line,1)=";INSTALL" then do
  180.     say
  181.     say delword(line,1,1)
  182.     parse pull response
  183.     buf=readln("I")
  184.     buf=insert(response,buf,pos("$RESPONSE",buf)-1)
  185.     buf=delstr(buf,pos("$RESPONSE",buf),9)
  186.     call writeln("O",buf)
  187.   end
  188.   else if strip(line)~="" then call writeln("O",line)
  189. end
  190. call close("O")
  191. call close("I")
  192.  
  193.  
  194. if exists("s:user-startup") then mode="A"
  195. else mode="W"
  196. call open("U","s:user-startup",mode)
  197. call writeln("U"," ")
  198. call writeln("U","; iNTERiNSTALL 1.51")
  199. call writeln("U",'assign AMITCP: "'||tcppath||'"')
  200. call close("U")
  201.  
  202.  
  203. say
  204. say
  205. say
  206. say "--- Please replace any old `internet' and `stopnet' icons"
  207. say "--- with the current versions."
  208. say
  209. say "iNSTALL COMPLETE.  REBOOT AND TYPE `internet' TO CONNECT!"
  210. call delay(1200)
  211.